What is no-case?
The no-case npm package is a utility for converting strings to lower case with spaces between words. It is useful for transforming strings into a more readable format, especially for user interfaces or data processing.
What are no-case's main functionalities?
Convert camelCase to no-case
This feature converts a camelCase string into a no-case string, where words are separated by spaces and all letters are in lower case.
const noCase = require('no-case');
const result = noCase('camelCaseString');
console.log(result); // Output: 'camel case string'
Convert snake_case to no-case
This feature converts a snake_case string into a no-case string, where underscores are replaced by spaces and all letters are in lower case.
const noCase = require('no-case');
const result = noCase('snake_case_string');
console.log(result); // Output: 'snake case string'
Convert kebab-case to no-case
This feature converts a kebab-case string into a no-case string, where hyphens are replaced by spaces and all letters are in lower case.
const noCase = require('no-case');
const result = noCase('kebab-case-string');
console.log(result); // Output: 'kebab case string'
Other packages similar to no-case
change-case
The change-case package provides a set of utilities for converting strings between different cases, such as camelCase, snake_case, and kebab-case. It offers more comprehensive functionality compared to no-case, as it supports multiple case transformations.
lodash
Lodash is a utility library that provides a wide range of functions for manipulating arrays, objects, and strings. It includes methods for case conversion, such as _.camelCase, _.snakeCase, and _.kebabCase, making it a versatile alternative to no-case.
voca
Voca is a string manipulation library that offers a variety of functions for working with strings, including case conversion. It provides methods like voca.camelCase, voca.snakeCase, and voca.kebabCase, similar to the functionality provided by no-case.
No Case
Transform a string to lower space cased. Optional locale and replacement character supported.
Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a toString
property, numbers and booleans. Empty values (null
and undefined
) will result in an empty string.
Installation
npm install no-case --save
Usage
var noCase = require('no-case')
noCase(null)
noCase('string')
noCase('dot.case')
noCase('camelCase')
noCase('Beyoncé Knowles')
noCase('A STRING', 'tr')
noCase('HELLO WORLD!', null, '_')
Typings
Includes a TypeScript definition.
License
MIT